package cn.iocoder.yudao.module.member.dal.mysql.activation;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.member.controller.admin.activation.userVo.UserActivationPageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.activation.ActivationDO;
import cn.iocoder.yudao.module.member.dal.dataobject.activation.UserActivationDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.member.controller.admin.activation.vo.*;

/**
 * 我的激活码 Mapper
 *
 * @author Alan
 */
@Mapper
public interface UserActivationMapper extends BaseMapperX<UserActivationDO> {

    default PageResult<UserActivationDO> selectPage(UserActivationPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UserActivationDO>()
                .eqIfPresent(UserActivationDO::getUserId, reqVO.getUserId())
                .eqIfPresent(UserActivationDO::getActivationCode, reqVO.getActivationCode())
                .betweenIfPresent(UserActivationDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(UserActivationDO::getId));
    }

}